const express = require('express');
const router = express.Router();
// menu数据
const menu_user=[
    {
        id:100,
        menuName:'首页',
        path:'home',
        iconUrl:'el-icon-s-home'
    },
    {   
        id:120,
        menuName:'个人中心',
        path:'profile',
        iconUrl:'el-icon-s-help'
    },
    {
        id:130,
        menuName:'订单查询',
        path:'orders',
        iconUrl:'el-icon-s-order'
    },
    {
        id:140,
        menuName:'场地预定',
        path:'stadium',
        iconUrl:'el-icon-s-promotion'
    },

]

const menu_admin=[
    {
        id:100,
        menuName:'用户管理',
        path:'userAd',
        iconUrl:'el-icon-user-solid'
    },
    {   
        id:120,
        menuName:'订单管理',
        path:'orderAd',
        iconUrl:'el-icon-s-order'
    },
    {
        id:130,
        menuName:'球馆管理',
        path:'stadiumAd',
        iconUrl:'el-icon-s-home'
    },
    {
        id:140,
        menuName:'场地管理',
        path:'courtAd',
        iconUrl:'el-icon-s-grid'
    },
    {
        id:150,
        menuName:'评论管理',
        path:'commentAd',
        iconUrl:'el-icon-s-comment'
    },
    {
        id:170,
        menuName:'公告管理',
        path:'noticeAd',
        iconUrl:'el-icon-message-solid'
    },
    {   
        id:160,
        menuName:'统计图表',
        path:'charts',
        iconUrl:'el-icon-s-data'
    },
]
const menu_courtAdmin = [
{   
    id:120,
    menuName:'订单管理',
    path:'orderAd',
    iconUrl:''
},
{
    id:130,
    menuName:'球馆管理',
    path:'stadiumAd',
    iconUrl:''
},
{
    id:140,
    menuName:'场地管理',
    path:'courtAd',
    iconUrl:''
},
{   
    id:160,
    menuName:'统计图表',
    path:'charts',
    iconUrl:''
},]
// 根据用户类型返回menu数据
router.get('/',(req,res)=>{
    let {type} = req.query;
    if(type === 'user'){
        res.json({
            status:200,
            data:menu_user,
            msg:'返回用户菜单'
        })
    } 
    else if(type ==='admin'){
        res.json({
            status:200,
            data:menu_admin,
            msg:'返回管理员菜单'
        })
    }
    else{
        res.json({
           status:400,
           msg:'参数错误'
        })
    }
})



module.exports = router;